package com.summer.main;

public class ColorTest {
	
	public static void main(String[] args) {
		
		int color1 =  0x00 << 24 | (0x03 << 16) | (0x03 << 8) | 0x03;	//00030303
		int color2 =  0xff << 24 | (0x30 << 16) | (0x30 << 8) | 0x30;	//ff303030
		int color3 =  0xf0 << 24 | (0x3 << 16) | (0x3 << 8) | 0x2;		//f0030302
		int color4 =  0x0f << 24 | (0x00 << 16) | (0x01 << 8) | 0x2;	//0f000102
		int color5 =  0xae << 24 | (0xff << 16) | (0x00 << 8) | 0x2;	//aeff0002
		int color6 =  0x11 << 24 | (0xff << 16) | (0xff << 8) | 0x0f;	//11ffff0f
		int color7 =  0xf0 << 24 | (0x3e << 16) | (0xaf << 8) | 0x56;	//f03eaf56
		
		System.out.println("colorR == " + fromRGB(Integer.MIN_VALUE));
		System.out.println("colorR == " + fromRGB(Integer.MAX_VALUE));
		System.out.println("colorR == " + fromRGB(0x000000));
		System.out.println("colorR == " + fromRGB(0xffffff));
		System.out.println("colorR == " + fromRGB(color1) + fromRGB(color1).equals("#030303"));
		System.out.println("colorR == " + fromRGB(color2) + fromRGB(color2).equals("#303030"));
		System.out.println("colorR == " + fromRGB(color3) + fromRGB(color3).equals("#030302"));
		System.out.println("colorR == " + fromRGB(color4) + fromRGB(color4).equals("#000102"));
		System.out.println("colorR == " + fromRGB(color5) + fromRGB(color5).equals("#ff0002"));
		System.out.println("colorR == " + fromRGB(color6) + fromRGB(color6).equals("#ffff0f"));
		System.out.println("colorR == " + fromRGB(color7) + fromRGB(color7).equals("#3eaf56"));

		
		System.out.println("colorA == " + fromARGB(Integer.MIN_VALUE));
		System.out.println("colorA == " + fromARGB(Integer.MAX_VALUE));
		System.out.println("colorA == " + fromARGB(0x00000000));
		System.out.println("colorA == " + fromARGB(0xffffffff));
		System.out.println("colorA == " + fromARGB(color1) + fromARGB(color1).equals("#00030303"));
		System.out.println("colorA == " + fromARGB(color2) + fromARGB(color2).equals("#ff303030"));
		System.out.println("colorA == " + fromARGB(color3) + fromARGB(color3).equals("#f0030302"));
		System.out.println("colorA == " + fromARGB(color4) + fromARGB(color4).equals("#0f000102"));
		System.out.println("colorA == " + fromARGB(color5) + fromARGB(color5).equals("#aeff0002"));
		System.out.println("colorA == " + fromARGB(color6) + fromARGB(color6).equals("#11ffff0f"));
		System.out.println("colorA == " + fromARGB(color7) + fromARGB(color7).equals("#f03eaf56"));
		
	}
	
	public static String fromRGB(int color) {
		String colorStr =  Integer.toHexString(0xff000000 | color);
        return "#" + colorStr.substring(colorStr.length() - 6);
    }
	
	public static String fromARGB(int color) {
		String colorStr =  Long.toHexString(0xff00000000000000L | color);
		return "#" + colorStr.substring(colorStr.length() - 8);
	}
	
}
